# 练习1

# Python 出现的次数

# Python is a programing language.
# Python is easy to learn.
# Python is widely used.


with open("./files/zxy.txt","r",encoding="utf-8") as f:
    # 将文件内容读取出来    read()  readlines()   readline  
    result = f.read() 
    # 使用字符串count方式，传入参数
    print(result.count('python'))



# 练习2
with open("./files/zxy.txt","r",encoding="utf-8") as f:
    # 通过read方式读取文件内容并打印
    res = f.read()
    print(res)
    # 行数
    count = 0 
    for line in f:
        count += 1
    print(f"总行数为：{count}")